var getFormInfo;
require(['layout'], function () {
	getFormInfo = function(mftId, carId, beginTime, endTime){
		$.ajaxExt({
			"url": "/reportFaultHandle/getFaultHandleFormInfo.htm",
			data:{
				"mftId": mftId,
				"beginTime": beginTime,
				"endTime": endTime
			}
		}).done(function(data){
			if(data.rcrdId) $("#rcrdId").html(data.rcrdId); else $("#rcrdId").html("-");
			if(data.crtTime) $("#crtTime").html(data.crtTime); else $("#crtTime").html("-");
			if(data.pcsTime) $("#pcsTime").html(data.pcsTime); else $("#pcsTime").html("-");
			if(data.licPltNo) $("#licPltNo").html(data.licPltNo); else $("#licPltNo").html("-");
			if(data.organName) $("#organName").html(data.organName); else $("#organName").html("-");
			if(data.eqmtCd) $("#eqmtCd").html(data.eqmtCd); else $("#eqmtCd").html("-");
			if(data.mftTypeName) $("#mftTypeName").html(data.mftTypeName); else $("#mftTypeName").html("-");
			if(data.mftGradeName) $("#mftGradeName").html(data.mftGradeName); else $("#mftGradeName").html("-");
			if(data.locate) $("#locate").html(data.locate); else $("#locate").html("-");
			if(data.mftOccurTime) $("#mftOccurTime").html(data.mftOccurTime); else $("#mftOccurTime").html("-");
			if(data.mftRpaTime) $("#mftRpaTime").html(data.mftRpaTime); else $("#mftRpaTime").html("-");
			if(data.lastingTime) $("#lastingTime").html(data.lastingTime); else $("#lastingTime").html("-");
			if(data.pcsTime){
				$("#pcsTime").html(data.pcsTime); 
				$("#handleTime").html(data.pcsTime); 
			} else {
				$("#pcsTime").html("-");
				$("#handleTime").html("-");
			}
			if(data.pcsUserName) $("#pcsUserName").html(data.pcsUserName); else $("#pcsUserName").html("-");
			if(data.pcsWay) $("#pcsWay").html(data.pcsWay); else $("#pcsWay").html("-");
		});
		
		getFaultHistoryInfo("近七天发生", mftId, carId, "03", $("#historyDay"));
		getFaultHistoryInfo(",本月共发生", mftId, carId, "04", $("#historyMonth"));
	};
	
	function getFaultHistoryInfo(msg, mftId, carId, dateType, obj){
		var result = "";
		$.ajaxExt({
			"url": "/reportFaultHandle/getFaultHandleHistoryInfo.htm",
			data:{
				"mftId": mftId,
				"carId": carId,
				"dateType": dateType
			}
		}).done(function(data){
			if(data && data.mftOccurFreq && data.lastingTime){
				result = data.mftOccurFreq+"次，总时长"+data.lastingTime;
			}else{
				result = "0次，总时长0";
			}
			obj.html(msg+result);
		});
	}
	

});
